Release 10.1A: OpenEdge Data Management:
DataServer for ODBC
Data types
ODBC data-source data types differ from OpenEdge data types. However, each data-source data type supported by the DataServer has at least one OpenEdge equivalent.
The DataServer translates ODBC data-source data types into OpenEdge equivalents and places the mapping into the schema holder. You can access this mapping information using the Data Dictionary. Note, however, that the Data Dictionary lists the ODBC SQL equivalents for data-source data types rather than the actual data-source data types. For example, the Data Dictionary lists the Sybase
datetimeandsmalldatetimedata types astimestamp, which is the equivalent ODBC SQL data type and not the Sybasetimestampdata type. There may also be some restrictions in data-source compatibility with OpenEdge. For example, the OpenEdge database cannot support a numeric or decimal field defined in Sybase with greater than 28 digits.You can also modify these definitions using the Data Dictionary. For example, the DataServer maps the Sybase
tinyintdata type to the OpenEdge equivalent,INTEGER. Suppose, however, that your application uses thetinyintfield in such a way that theLOGICALdata type is a more suitable equivalent. In this case, you would change the data type fromINTEGERtoLOGICALin the schema holder. If you do change a data-type mapping, be sure to select a data type that accommodates the data in the column, otherwise conversion errors might occur at run time. Also, remember to specify a display format that is appropriate for the new data type. See the "Modifying a schema holder" section for an explanation of how to use the Data Dictionary to change OpenEdge data types in the schema holder.The tables in the following sections list, for each ODBC data source, the data types supported by the DataServer, the ODBC SQL equivalents, and the default OpenEdge equivalents. The notes that follow some tables provide additional information.
DB2
Table 2–3 lists the DB2 data types supported by the DataServer, their ODBC SQL equivalents, and their default OpenEdge equivalents. The data types in parentheses are alternative data types that you can specify in the schema holder for your DB2 data source. You cannot change the list of default data types in a schema holder for a DB2 data source.
Table 2–3: DB2 Data-type equivalencies ( DB2
Data type SQL-ODBC
data type OpenEdge
defaultintegerSQL_TYPE_INTEGERINTEGER
(DECIMAL or LOGICAL)smallintSQL_TYPE_SMALLINTINTEGER
(DECIMAL or LOGICAL)decimal1SQL_TYPE_DECIMALDECIMAL
(INTEGER)real/float2SQL_TYPE_REALDECIMAL
(INTEGER)double precision/float2SQL_TYPE_FLOATDECIMAL
(INTEGER)dateSQL_TYPE_TIMESTAMPCHARACTER
(DATE)timeSQL_TYPE_TIMESTAMPCHARACTER3timestampSQL_TYPE_TIMESTAMPchar(n)SQL_TYPE_CHARACTERCHARACTERvarchar(n)SQL_TYPE_VARCHARCHARACTERlong varchar(n)SQL_TYPE_LONGVARCHARCHARACTERgraphicSQL_TYPE_BINARYCHARACTERvargraphic(n)SQL_TYPE_VARBINARYCHARACTERlong vargraphicSQL_TYPE_LONGBINARYCHARACTER
- The DataServer truncates values in DB2 decimal or numeric columns defined with a scale greater than 10. In the case of float columns, it reliably translates up to 10 places only.
- Do not use the float or real data types in joins, in primary indexes, or with the equality operator.
- When you change the default mapping of the DB2 timestamp or time data types to the OpenEdge DATE data type, OpenEdge truncates the time portion of the date.
- The DB2 timestamp data type contains both date and time information. The DataServer maps this to the OpenEdge CHARACTER data type; however, you can change the CHARACTER data type to DATE in the schema holder. If you do, remember to change the format to match the new data type. For example, if you change the data type to DATE, specify a date format, such as 99/99/99.
- OpenEdge supports an emulation process to determine time zone details. For more information, see the XXX section. (bhamel - specifics of this statement and the specific details about this emulation process still need to be determined and located later in this chapter.)
Informix
Table 2–4 lists the Informix data types supported by the DataServer, their ODBC SQL equivalents, and their default OpenEdge equivalents.
Sybase
Table 2–5 lists the Sybase data types, their ODBC SQL equivalents, and their default OpenEdge equivalents. The data types in parentheses are alternative data types that you can specify in the schema holder for your Sybase data source.
Table 2–5: Sybase data-type equivalencies ( Sybasedata type SQL-ODBC data type OpenEdge defaultintegerSQL_TYPE_INTEGERINTEGER
(DECIMAL)smallintSQL_TYPE_SMALLINTINTEGER
(DECIMAL or LOGICAL)tinyintSQL_TYPE_TINYINTINTEGER
(DECIMAL or LOGICAL)decimalSQL_TYPE_DECIMALDECIMAL
(INTEGER)numeric1SQL_TYPE_DECIMALDECIMAL
(INTEGER)float2SQL_TYPE_FLOATDECIMAL
(INTEGER)double precisionSQL_TYPE_DOUBLEDECIMAL
(INTEGER)realSQL_TYPE_REALDECIMAL
(INTEGER)char3SQL_TYPE_CHARCHARACTERvarchar3SQL_TYPE_VARCHARCHARACTERSQL_TYPE_CHARCHARACTERnvarchar4SQL_TYPE_VARCHARCHARACTERtext, ntextSQL_TYPE_LONGVARCHARCHARACTER5moneySQL_TYPE_DECIMALDECIMAL
(INTEGER)smallmoneySQL_TYPE_DECIMALDECIMAL
(INTEGER)datetimeSQL_TYPE_TIMESTAMPsmalldatetimeSQL_TYPE_TIMESTAMPbinary3SQL_TYPE_BINARYCHARACTERvarbinarySQL_TYPE_VARBINARYCHARACTERimageSQL_TYPE_LONGVARBINARYCHARACTER5bitSQL_TYPE_BITLOGICALtimestamp8SQL_TYPE_VARBINARY Unsupportedidentity NA You can only display these values.9
- The DataServer truncates values in Sybase decimal or numeric columns defined with a scale greater than 10. In the case of float columns, it reliably translates up to 10 places only.
- Do not use the float or real data types in joins, in primary keys, or with the equality operator.
- When you define a binary or char column to allow nulls, Sybase stores the data type definitions as varbinary and varchar respectively. The equivalent SQL data types that the Data Dictionary displays for these are SQL VARBINARY, SQL VARCHAR, and SQL VARCHAR. This does not affect how the DataServer maps the Sybase data types to OpenEdge data types.
- You can access nchar and nvarchar data types as Sybase objects and bypass their conversion to CHARACTER by running a Sybase stored procedure or using the send–sql–statement option supported by the DataServer.
- Although the Sybase text and image fields can hold up to 2MB, OpenEdge retrieves only up to 32K. If you are using an OpenEdge Format phrase, there might be additional limits on the size of text and image fields. See the Format Phrase entry in the OpenEdge Development: Progress 4GL Reference . You can use the DataServer (-Dsrv MAX_LENGTH) startup parameter to limit the amount of returned text data.
- By default, the initial value of a Sybase datetime or smalldatetime column is unknown ("?"). The default initial values for binary and varbinary are also unknown (“?”). The Sybase datetime and smalldatetime data types contain both date and time information. The DataServer maps these to the OpenEdge CHARACTER data type; however, you can change the CHARACTER data type to INTEGER or DATE in the schema holder. If you do this, remember to change the format to match the new data type. For example, if you change the data type to DATE, specify a date format, such as 99/99/99.
- When you change the default mapping of Sybase datetime or smalldatetime data types to the OpenEdge DATE data type, OpenEdge truncates the time portion of the date.
- The DataServer considers a timestamp data type to be a hidden value. It is not visible to the user, but you can still access a Sybase table that contains a timestamp column.
- You can display values in identity columns, but you cannot insert or update them.
- OpenEdge supports an emulation (or evaluation??) process to determine time zone details. For more information, see the "ODBC Implementation for the DATETIME and DATETIME-TZ data types" section. (bhamel - specifics of this statement and the specific details about this emulation process still need to be determined and located later in this chapter.)
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |